The present invention relates generally to software development and more specifically to various aspects of language development within any of various programming languages, such as a platform-independent, object-oriented programming language, as one example.
In various programming languages, parametric polymorphism (e.g., generics) may be considered as a way to make a language more expressive, while still maintaining full static type-safety. Parametric polymorphism may allow a function or a data type to be written in a generic fashion such that it can handle various data types in the same manner regardless of their different types. Such functions and data types may be called generic functions and generic datatypes. For example, a generic method may be written <T> makeList (T t1, T t2), which means that it can take as parameters elements of any type T, where T is specified separately from the specification of makeList.
Sometimes, when using a platform-independent, object oriented language, one cannot generify over primitive types without boxing (e.g., automatically converting a value of a primitive type like int into an object of a corresponding wrapper class like Integer).
Parametric polymorphism (generics) may also involve a tradeoff between code size, generation costs and type specificity. For example, a programming language may support primitive-specialized generics, but may generate specialized classes statically, possibly at potentially increased cost to code footprint and compilation cost. Another programming language may use a templatized bytecode format, while only performing specialization at runtime, which may require an additional step before using a generic class file, thereby potentially harming startup performance.